package com.iims.system.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.iims.common.annotation.Excel;
import com.iims.common.annotation.Excel.ColumnType;
import com.iims.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

/**
 * 分组
 *
 * @author fanpei
 * @date 2021/5/7 14:45
 */
@ApiModel("分组信息")
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("cmis_sys_group")
public class SysGroup extends BaseEntity {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(name = "groupId", value = "主键,修改时必传", position = -1)
    @Excel(name = "分组序号", cellType = ColumnType.NUMERIC)
    @TableId(value = "group_id", type = IdType.AUTO)
    private Long groupId;

    @ApiModelProperty(value = "分组编码:分组编码长度不能超过64个字符", required = true)
    @Excel(name = "分组编码")
    @NotBlank(message = "分组编码不能为空")
    @Size(min = 0, max = 64, message = "分组编码长度不能超过64个字符")
    private String groupCode;

    @ApiModelProperty(value = "分组名称:分组名称长度不能超过50个字符", required = true)
    @Excel(name = "分组名称")
    @NotBlank(message = "分组名称不能为空")
    @Size(min = 0, max = 50, message = "分组名称长度不能超过50个字符")
    private String groupName;

    @ApiModelProperty(value = "分组排序", required = true)
    @Excel(name = "分组排序")
    private Integer groupSort;

    /**
     * 状态（1正常 0停用）
     */
    @ApiModelProperty(value = "状态:来源于字典sys_normal_disable", required = true)
    @Excel(name = "状态", readConverterExp = "1=正常,0=停用")
    private String status;

    /**
     * 角色列表
     */
    @ApiModelProperty(value = "关联角色列表", hidden = true)
    @TableField(exist = false)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Long[] roleIds;

    /**
     * 用户列表
     */
    @ApiModelProperty(value = "关联用户列表", hidden = true)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @TableField(exist = false)
    private Long[] userIds;
}
